<style lang="scss">
  @import 'index';
</style>

<template>
  <div class="ga-container">
    <div class="ga-product-comments">

      <!--评分-->
      <div class="top-box">
        <div>
          <span>综合评分</span>
          <span>{{avg}}星</span>
        </div>
        <div class="gYellow">{{praiserate}}%好评率</div>
      </div>

      <!--tabs-->
      <div class="tabs clear">
        <a class="item active" href="#">全部({{count}})</a>
        <!-- <a class="item" href="#">好评(40)</a>
        <a class="item" href="#">晒图(10)</a> -->
      </div>

      <!--评论列表-->
      <ul class="comment-list" v-for="(item,index) in list" :key="index">
        <li class="item">

          <div class="person">
            <div>
              <div class="img-box">
                <img class="img" :src="item.icon" alt="">
              </div>
              <span class="name">{{item.nickname}}</span>
            </div>

            <span class="gGray">{{item.add_time}}</span>
          </div>

          <div class="con-box">
            {{item.evaluate}}
          </div>

          <ul class="img-list clear">
            <li class="img-box" v-for="(imgvalue,imgindex) in item.imglist" :key="imgindex">
              <img class="img" :src="imgvalue" alt="">
            </li>
          </ul>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {

  data () {
    return {
       list: [],
       count: 0,
       praiserate: '100%',
       avg: 5
    }
  },
  methods: {
     async load () {
       console.log(this.$root.$mp.query.id)
       this.$_util.ajax.get('https://guo-a.com/mapi/product/geteva?id=' + this.$root.$mp.query.id).then((res)=>{
        console.log(res)
          if(res.code === 200){
             this.list = res.data
             this.count = res.count
             this.praiserate = res.praiserate
             this.avg = res.avg
          }
       })
     }
  },
  created () {

  },
  onShow () {
     if(!this.$root.$mp.query.hasOwnProperty('id')){
          wx.navigateBack()
      }
  },
  mounted () {
       this.load()
  },
}
</script>
